package com.example.gmallpublisher.service.impl;

import com.example.gmallpublisher.bean.*;
import com.example.gmallpublisher.mapper.TrafficScStatsMapper;
import com.example.gmallpublisher.service.TrafficScStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author : songyuan
 * @Description :
 * Date : 2022/8/22 14:18
 * @Version : 1.0
 */
@Service
public class TrafficScStatsServiceImpl implements TrafficScStatsService {

    // 自动装载 Mapper 接口实现类

    @Autowired
    TrafficScStatsMapper trafficScStatsMapper;

    // 1. 获取各渠道独立访客数
    @Override
    public List<TrafficUvCt> getUvCt(Integer date) {
        return trafficScStatsMapper.selectUvCt(date);
    }

    // 2. 获取各渠道会话数
    @Override
    public List<TrafficSvCt> getSvCt(Integer date) {
        System.out.println(date);
        return trafficScStatsMapper.selectSvCt(date);
    }

    // 3. 获取各渠道会话平均页面浏览数
    @Override
    public List<TrafficPvPerSession> getPvPerSession(Integer date) {
        return trafficScStatsMapper.selectPvPerSession(date);
    }

    // 4. 获取各渠道会话平均页面访问时长
    @Override
    public List<TrafficDurPerSession> getDurPerSession(Integer date) {
        return trafficScStatsMapper.selectDurPerSession(date);
    }

    // 5. 获取各渠道跳出率
    @Override
    public List<TrafficUjRate> getUjRate(Integer date) {
        return trafficScStatsMapper.selectUjRate(date);
    }
}
